﻿using App.Common;
using QxFramework.Core;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class StartUI : UIBase
{
    Transform explainWindow;
    public override int UILayer => base.UILayer;
    public override void OnDisplay(object args)
    {
        base.OnDisplay(args);
        this.transform.Find("StartBut").GetComponent<Button>().onClick.AddListener(StartBut);
        this.transform.Find("ExplainBut").GetComponent<Button>().onClick.AddListener(ExplainBut);
        explainWindow = this.transform.Find("Explain");
        explainWindow.Find("Yes").GetComponent<Button>().onClick.AddListener(Yes);
    }

    protected override void OnClose()
    {
        base.OnClose();
    }

    protected override void OnRegisterHandler()
    {
        base.OnRegisterHandler();
    }
    void StartBut()
    {
        UIManager.Instance.Close(this);
        ProcedureManager.Instance.ChangeTo<GameProcedure>();
    }
    void ExplainBut()
    {
        if (!explainWindow.gameObject.activeSelf)
        {
            explainWindow.gameObject.SetActive(true);
        }
    }
    void Yes()
    {
        if (explainWindow.gameObject.activeSelf)
        {
            explainWindow.gameObject.SetActive(false);
        }
    }
}
